package org.eleorc.ioc.annotationbased.value;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.Map;

@Component
public class MovieRecommender {
    private final String catalog;

    @Value("${my.defaultMovie}")
    private Movie defaultMovie;

    @Value("#{systemProperties['user.country'] + ':movieType' }")
    private String movieType;

//    @Value("${my.countOfMoviesPerCatalog}") // Cannot convert value of type 'java.lang.String' to required type 'java.util.Map': no matching editors or conversion strategy found
    @Value("#{{'Thriller': 100, 'Comedy': 300}}")
    private Map<String, Integer>  countOfMoviesPerCatalog;


    public MovieRecommender(@Value("${catalog.name:defaultCatalog}") String catalog) {
        this.catalog = catalog;
    }

    public void recommend(){
        System.out.println(catalog);
        System.out.println(defaultMovie);
        System.out.println(movieType);
        System.out.println(countOfMoviesPerCatalog);
    }
}
